<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    /*
    Promise.resolve:
      -默认返回一个成功的promise实例,值为resolve调用的实参
      -如果resolve的参数是一个promise实例,则resolve的返回值与promise实例参数保持一致
      -可以快速的把一个值包装成promise对像
    
    */
    // const result = Promise.resolve()//fulfilled undefined
    // const result = Promise.resolve(1)//fulfilled 1
    const result = Promise.resolve(new Promise((resolve,reject)=>{
        // resolve("成功")//fulfilled 成功
        reject("失败")//rejected 失败
    }))
    console.log("result",result);


    /*
    Promise.reject:
        -Promise,reject方法默认返回失败的promise实例
        值是reject接收的实参,无论这个实参是不是promise对象
    
    */

    // const result2 = Promise.reject(1)
    const result2 = Promise.reject(new Promise((resolve,reject)=>{
        // resolve(1) //rejected  Promise
        reject(1)
    }))

    console.log("result2",result2);


        
    </script>
</body>
</html>